#ifndef GENIE_EEPROM
#define GENIE_EEPROM

#define MANUAL_BIT_TOGGLING

#define EEPROM_ADDR                            0xA0

typedef enum
{
   EEPROM_OK = 0
   , EEPROM_BUSY
   , EEPROM_NO_ADDRESS
   , EEPROM_WRITE
   , EEPROM_READ
   , EEPROM_NO_RECORD
   , EEPROM_RECORD_SIZE
   , EEPROM_RECORD_DATA
} EEPROM_ERR;


#define RECORD_MAGIC_OPTION_1                      	0xF5
#define RECORD_MAGIC_OPTION_L1                  	0xF8
#define RECORD_MAGIC_OPTION_2                      	0xF6
#define RECORD_MAGIC_OPTION_L2                  	0xF9
#define RECORD_MAGIC_OPTION_3                   	0xF7
#define RECORD_MAGIC_OPTION_L3                  	0xFA
#define RECORD_MAGIC_FAULT                      	0x57
#define RECORD_MAGIC_LIFT_DRIVE                 	0x9A
#define RECORD_MAGIC_ELEC3                      	0x54
#define RECORD_MAGIC_SMALL_SLAB                    	0x39
#define RECORD_MAGIC_ELEC1                     		0x78
#define RECORD_MAGIC_ELEC2                         	0x21
#define RECORD_MAGIC_TEST                          	0xA5
#define RECORD_MAGIC_BATTERY                       	0x5A
#define RECORD_MAGIC_TRIP_ANGLE                    	0x93
#define RECORD_LOAD_SENSING_ANGLE_SENSOR_ARRAY        0x66
#define RECORD_LOAD_SENSING_PRESSURE_SENSOR_ARRAY     0x99
#define RECORD_NOLOAD_ANGLE_SENSOR_ARRAY           	  0xDA
#define RECORD_NOLOAD_PRESSURE_SENSOR_ARRAY           0xAD
#define RECORD_UP_LOAD_SENSING_ANGLE_SENSOR_ARRAY     0x77
#define RECORD_UP_LOAD_SENSING_PRESSURE_SENSOR_ARRAY  0x88
#define RECORD_UP_NOLOAD_ANGLE_SENSOR_ARRAY           0xCB
#define RECORD_UP_NOLOAD_PRESSURE_SENSOR_ARRAY        0xBC
#define RECORD_DN_LOAD_SENSING_ANGLE_SENSOR_ARRAY     0x44
#define RECORD_DN_LOAD_SENSING_PRESSURE_SENSOR_ARRAY  0x55
#define RECORD_DN_NOLOAD_ANGLE_SENSOR_ARRAY           0xFE
#define RECORD_DN_NOLOAD_PRESSURE_SENSOR_ARRAY        0xEF
#define RECORD_LOAD_SENSING_CALIBRATION_STATUS        0x82
#define RECORD_MAGIC_TIME                          	  0x45
#define RECORD_MAGIC_LIFT_LOCKSET                  	  0x47
#define RECORD_MAGIC_ECULOCKLIB_DATA1              	  0x49
#define RECORD_MAGIC_HOURMETER                     	  0x50
#define RECORD_MAGIC_OUTDOOR_MODE                  	  0x51
#define RECORD_MAGIC_BATTERY_Level                 	  0x52
#define RECORD_MAGIC_ECULOCKLIB_DATA2              	  0x53
#define RECORD_MAGIC_ECULOCKLIB_DATA3              	  0x56
#define RECORD_MAGIC_ECULOCKLIB_DATA4              	  0x58
#define RECORD_MAGIC_ECULOCKLIB_DATA_BeforeRecovery   0x59
#define RECORD_MAGIC_ECULOCKLIB_DATA_RecoveryCnt   	  0x5B



extern EEPROM_ERR EE_Write(UINT16 wAddress, UINT8 * pbData, UINT16 wLength);
extern EEPROM_ERR EE_WritePages(UINT16 wAddress, UINT8 * pbData, UINT16 wLength);
extern EEPROM_ERR EE_Read(UINT16 wAddress, UINT8 * pbData, UINT16 wLength);
extern EEPROM_ERR record_read(UINT8 bMagic, UINT8 bSize, UINT8  * pbRecordData);
extern EEPROM_ERR record_write(UINT8 bMagic, UINT8 bSize, UINT8  * pbRecordData);
extern EEPROM_ERR record_write_verify(UINT8 bMagic, UINT8 bSize, UINT8  * pbRecordData);
extern EEPROM_ERR EE_Write_Byte(UINT16 wAddress, UINT8 bData, UINT16 wLength);

#endif // GENIE_EEPROM
